﻿namespace OrderSystem.Core.Domain
{
    public class Product : BaseEntity
    {
        public virtual string Name { get; set; }
        public virtual string Tag { get; set;}

        public override string ToString()
        {
            return string.Format("Id = {0} Name = {1}", Id, Name);
        }

        public override bool Equals(object obj)
        {
            var compareProduct = obj as Product;

            if (compareProduct == null) return false;

            return compareProduct.GetHashCode() == GetHashCode();
        }

        public override int GetHashCode()
        {
            return string.Format("{0}{1}{2}{3}", GetType().Name, Id, Name, Tag).GetHashCode();
        }
    }
}
